

import request from '@/utils/request'


/**
 * 零活管理 列表
 * @param pram
 */
export function workListApi(params) {
  return request({
    url: `/getWorkList`,
    method: 'get',
    params
  })
}

export function valuationList(params) {
  return request({
    url: `/getWorkValuation`,
    method: 'get',
    params
  })
}

/**
 * 抢活
 * @param pram
 */
export function robWorkApi(pram) {
  const data = {
    work_id : pram
  }
  return request({
    url: `/robWork`,
    method: 'post',
    data
  })
}

/**
 * 零活 详情
 * @param prams
 */
export function workDetailApi(params) {
  return request({
    url: '/getWorkDetail',
    method: 'get',
    params
  })
}

/**
 * 改价
 * @param pram
 */
export function workUpdateApi(data) {
  return request({
    url: `/changeWorkPrice`,
    method: 'post',
    data
  })
}

/**
 * 零工申请列表
 * @param prams
 */
export function getApplyApi(params) {
  return request({
    url: '/getWorkApplyList',
    method: 'get',
    params
  })
}

/**
 * 派遣
 * @param pram
 */
export function assignApplyApi(pram) {
  const data = {
    work_id : pram.work_id,
    ids : pram.ids
  }
  return request({
    url: `/employedWorkUser`,
    method: 'post',
    data
  })
}

/**
 * 取消派遣
 * @param pram
 */
export function cancelAssign(pram) {
  const data = {
    id : pram
  }
  return request({
    url: `/cancelEmployedWorkUser`,
    method: 'post',
    data
  })
}

/**
 * 已派遣人数
 * @param prams
 */
export function getEmployedNumApi(params) {
  return request({
    url: '/getEmployedNum',
    method: 'get',
    params
  })
}

/**
 * 延期
 * @param pram
 */
export function workDelayApi(data) {
  return request({
    url: `/workDelay`,
    method: 'post',
    data
  })
}

/**
 * 完工
 * @param pram
 */
export function workFinishApi(data) {
  return request({
    url: `/workFinish`,
    method: 'post',
    data
  })
}

/**
 * 评价工人
 * @param pram
 */
export function commentUpdateApi(data) {
  return request({
    url: `/workComment`,
    method: 'post',
    data
  })
}

/**
 * 获取评价详情
 * @param prams
 */
export function getCommentInfoApi(params) {
  return request({
    url: '/commentInfo',
    method: 'get',
    params
  })
}

export function doAdd(data) {
  return request({
    url: '/saveWork',
    method: 'POST',
    data: data
  })
}

export function doDel(pram) {
  const data = {
    id: pram.id,
  }
  return request({
    url: '/delWork',
    method: 'GET',
    params : data
  })
}

